From ae87e7ed7e8671ab95fdfad222a0766fca8097bc Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Sat, 13 Mar 2004 13:42:17 +0000 Subject: [PATCH] made setSquidMaxage an accessor, default mSquidMaxage = 0 --- includes/OutputPage.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7288b242fc..dd2cfd693b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -32,6 +32,7 @@ class OutputPage { $this->mDoNothing = false; $this->mContainsOldMagic = $this->mContainsNewMagic = 0; $this->mParserOptions = ParserOptions::newFromUser( $temp = NULL ); + $this->mSquidMaxage = 0; } function addHeader( $name, $val ) { array_push( $this->mHeaders, "$name: $val" ) ; } @@ -173,12 +174,11 @@ class OutputPage { # Set the maximum cache time on the Squid in seconds function setSquidMaxage( $maxage ) { - global $wgSquidMaxage; - $wgSquidMaxage = $maxage; + $this->mSquidMaxage = $maxage; } function sendCacheControl() { - global $wgUseSquid, $wgUseESI, $wgSquidMaxage; + global $wgUseSquid, $wgUseESI; # FIXME: This header may cause trouble with some versions of Internet Explorer header( "Vary: Accept-Encoding, Cookie" ); if( $this->mLastModified != "" ) { @@ -192,7 +192,7 @@ class OutputPage { wfDebug( "** proxy caching with ESI; {$this->mLastModified} **\n", false ); # start with a shorter timeout for initial testing # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"'); - header( 'Surrogate-Control: max-age='.$wgSquidMaxage.'+'.$wgSquidMaxage.', content="ESI/1.0"'); + header( 'Surrogate-Control: max-age='.$wgSquidMaxage.'+'.$this->mSquidMaxage.', content="ESI/1.0"'); header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' ); } else { # We'll purge the proxy cache for anons explicitly, but require end user agents @@ -202,7 +202,7 @@ class OutputPage { wfDebug( "** local proxy caching; {$this->mLastModified} **\n", false ); # start with a shorter timeout for initial testing # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" ); - header( 'Cache-Control: s-maxage='.$wgSquidMaxage.', must-revalidate, max-age=0' ); + header( 'Cache-Control: s-maxage='.$this->mSquidMaxage.', must-revalidate, max-age=0' ); } } else { # We do want clients to cache if they can, but they *must* check for updates -- 2.20.1